package com.bqjr.xms;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.circuitbreaker.EnableCircuitBreaker;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.cloud.client.loadbalancer.LoadBalanced;
import org.springframework.cloud.netflix.feign.EnableFeignClients;
import org.springframework.cloud.netflix.hystrix.dashboard.EnableHystrixDashboard;
import org.springframework.context.annotation.Bean;
import org.springframework.web.client.RestTemplate;

/**
 * Description: ConsumerBeehiveApplication.
 * Created by XHZ on 2017/8/6.
 */
@SpringBootApplication
@EnableDiscoveryClient //开启eureka服务
@EnableFeignClients //开启feigin注解
@EnableCircuitBreaker //开启Hystrix  @EnableCircuitBreaker或@EnableHystrix
@EnableHystrixDashboard //开启dashboard图形监控
public class ConsumerBeehiveApplication {
    @Bean
    @LoadBalanced
    public RestTemplate restTemplate() {
        //用于调用"提供者"的方法
        return new RestTemplate();
    }

    public static void main(String[] args) {
        SpringApplication.run(ConsumerBeehiveApplication.class, args);
    }
}
